/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cliensocket;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.Socket;

/**
 *
 * @author Ali Subhani
 */
public class ClienSocket {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       try{
        Socket ClintSock = new Socket("localhost",9999 );
        PrintStream pr = new PrintStream(ClintSock.getOutputStream());
        System.out.println("Enter the Text");
        InputStreamReader is = new InputStreamReader(System.in); 
        BufferedReader br = new BufferedReader(is);
        String msg = br.readLine();
        pr.println(msg);
        //get recponse from sever
        BufferedReader bdr = new BufferedReader (new InputStreamReader(ClintSock.getInputStream()));
        String response =bdr.readLine();
        System.out.println(response);
        
       }
       catch (Exception e){
       System.out.println(e);
       }
       }
    
}
